Failed Conditions
Push — master ( 2a10ca...dc3f81 )
by Yo
01:45
created

Request.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 8
Bugs 0 Features 0
Metric Value
cc 1
c 8
b 0
f 0
nc 1
nop 6
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 9.4285
1
"use strict";
2
3
class Request {
4
    /**
5
     * @param {string}  uri
6
     * @param {string}  method
7
     * @param {Object}  payload
8
     * @param {Object}  queryString
9
     * @param {Object}  headers
10
     * @param {boolean} json
11
     */
12
    constructor(uri, method = 'GET', payload = {}, queryString = {}, headers = {}, json = true) {
13 10
        this.uri = uri;
14 10
        this.method = method;
15 10
        this.payload = payload;
16 10
        this.queryString = queryString;
17 10
        this.headers = headers;
18 10
        this.json = json;
19
    }
20
21
    /**
22
     * @public
23
     * @returns {string}
24
     */
25
    getUri() {
26 14
        return this.uri;
27
    }
28
29
    /**
30
     * @public
31
     * @returns {Object}
32
     */
33
    getPayload() {
34 23
        return this.payload;
35
    }
36
37
    /**
38
     * @public
39
     * @returns {Object}
40
     */
41
    getQueryString() {
42 22
        return this.queryString;
43
    }
44
45
    /**
46
     * @public
47
     * @returns {Object}
48
     */
49
    getHeaders() {
50 14
        return this.headers;
51
    }
52
53
    /**
54
     * @public
55
     * @returns {string}
56
     */
57
    getMethod() {
58 14
        return this.method;
59
    }
60
61
    /**
62
     * @public
63
     * @returns {boolean}
64
     */
65
    isJson() {
66 14
        return this.json;
67
    }
68
}
69
70
module.exports = Request;
71